/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.service.http;

import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.util.StringPool;

import com.vijayan.profile.model.Profile;

import java.util.Date;
import java.util.List;

/**
 * @author    vijayan
 * @generated
 */
public class ProfileJSONSerializer {
	public static JSONObject toJSONObject(Profile model) {
		JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

		jsonObj.put("profileId", model.getProfileId());
		jsonObj.put("profileCode", model.getProfileCode());
		jsonObj.put("createdForMy", model.getCreatedForMy());
		jsonObj.put("profileName", model.getProfileName());
		jsonObj.put("gender", model.getGender());

		Date birthDateWithTime = model.getBirthDateWithTime();

		String birthDateWithTimeJSON = StringPool.BLANK;

		if (birthDateWithTime != null) {
			birthDateWithTimeJSON = String.valueOf(birthDateWithTime.getTime());
		}

		jsonObj.put("birthDateWithTime", birthDateWithTimeJSON);
		jsonObj.put("rasi", model.getRasi());
		jsonObj.put("star", model.getStar());
		jsonObj.put("dosam", model.getDosam());
		jsonObj.put("religion", model.getReligion());
		jsonObj.put("caste", model.getCaste());
		jsonObj.put("subcaste", model.getSubcaste());
		jsonObj.put("height", model.getHeight());
		jsonObj.put("weight", model.getWeight());
		jsonObj.put("complexion", model.getComplexion());
		jsonObj.put("motherTongue", model.getMotherTongue());
		jsonObj.put("languageKnown", model.getLanguageKnown());
		jsonObj.put("maritalStatus", model.getMaritalStatus());
		jsonObj.put("children", model.getChildren());
		jsonObj.put("residingCountry", model.getResidingCountry());
		jsonObj.put("residingState", model.getResidingState());
		jsonObj.put("residingCity", model.getResidingCity());
		jsonObj.put("address", model.getAddress());
		jsonObj.put("postalCode", model.getPostalCode());
		jsonObj.put("homePhone", model.getHomePhone());
		jsonObj.put("mobile", model.getMobile());
		jsonObj.put("emailAddress", model.getEmailAddress());
		jsonObj.put("education", model.getEducation());
		jsonObj.put("profession", model.getProfession());
		jsonObj.put("currency", model.getCurrency());
		jsonObj.put("annualIncome", model.getAnnualIncome());
		jsonObj.put("hobbies", model.getHobbies());
		jsonObj.put("aboutMe", model.getAboutMe());
		jsonObj.put("familyValue", model.getFamilyValue());
		jsonObj.put("familyType", model.getFamilyType());
		jsonObj.put("familyStatus", model.getFamilyStatus());
		jsonObj.put("securityNo1", model.getSecurityNo1());
		jsonObj.put("securityNo2", model.getSecurityNo2());
		jsonObj.put("photoSecurityCode", model.getPhotoSecurityCode());

		Date lastLoggedIn = model.getLastLoggedIn();

		String lastLoggedInJSON = StringPool.BLANK;

		if (lastLoggedIn != null) {
			lastLoggedInJSON = String.valueOf(lastLoggedIn.getTime());
		}

		jsonObj.put("lastLoggedIn", lastLoggedInJSON);
		jsonObj.put("status", model.getStatus());
		jsonObj.put("age", model.getAge());
		jsonObj.put("scheme", model.getScheme());
		jsonObj.put("horoscope", model.getHoroscope());
		jsonObj.put("addedBy", model.getAddedBy());

		Date dateAdded = model.getDateAdded();

		String dateAddedJSON = StringPool.BLANK;

		if (dateAdded != null) {
			dateAddedJSON = String.valueOf(dateAdded.getTime());
		}

		jsonObj.put("dateAdded", dateAddedJSON);

		Date dateModified = model.getDateModified();

		String dateModifiedJSON = StringPool.BLANK;

		if (dateModified != null) {
			dateModifiedJSON = String.valueOf(dateModified.getTime());
		}

		jsonObj.put("dateModified", dateModifiedJSON);
		jsonObj.put("modifiedBy", model.getModifiedBy());
		jsonObj.put("modifiedCount", model.getModifiedCount());
		jsonObj.put("companyId", model.getCompanyId());
		jsonObj.put("groupId", model.getGroupId());

		return jsonObj;
	}

	public static JSONArray toJSONArray(
		com.vijayan.profile.model.Profile[] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Profile model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		com.vijayan.profile.model.Profile[][] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Profile[] model : models) {
			jsonArray.put(toJSONArray(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		List<com.vijayan.profile.model.Profile> models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Profile model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}
}